Interactive demo of image recognition

In this demo, we present a basic demonstration of our project by training the qGAN to recognize an 8 $\times$ 8 pixel art of smiley face. Enjoy :)

Module import

First, install python modules as following:

Second, import our self-written module in the --imgen.py--

Image loading

Now, initialze the input pixel art.

Initialize the qGAN class for image recognition

Load the pixel art. After preprocessing with Gaussian filters, this is what your original art looks like!

qGAN training

Train the qGAN and see how the output of the generator changes in 300 epochs! (Spoiler alert: you can see your smiley face again after only ~30 epochs!)

Generate interactive probability distribution output with training epoch

Plot loss function versus steps. A trend towards convergence can be seen.

Plot the final averaged distribution output. It matches pretty well with the original pixel face!

Get the final averaged variational parameters for the circuit